package com.example.springsecurity.controller;

import com.example.springsecurity.pojo.R;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: anwenbiao
 * @Description: TODO
 * @DateTime: 2023/2/421:47
 */
@RestController
public class HomeController {
    
    @RequestMapping("home")
    public R home(){
        Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
        
        return R.success(authentication);
    }
}
